package com.globallogic.dailyplanner.utils;

import java.util.Date;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

@Component
@Scope("request")
public class FromDateValidator implements Validator{
	
	public void validate(FacesContext arg0, UIComponent arg1, Object value)
            throws ValidatorException {
		Date from = (Date) value;
		
		DateUtil.beforeNow(from, "From date must after now.");
	}
}
